home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / Interfaces & Libraries / Interfaces / AIncludes / CursorDevices.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  7.5 KB  |  282 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        CursorDevices.a
  3. ;
  4. ;    Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__CURSORDEVICES__') = 'UNDEFINED' THEN
  21. __CURSORDEVICES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  30.     include 'MixedMode.a'
  31.     ENDIF
  32. ;
  33. ;                       * * *  W A R N I N G  * * * 
  34. ;
  35. ;    On currently shipping PowerMacs, the CursorDevices manager is implemented
  36. ;    in 68K code and emulated.  Unfortunately, the MixedMode glue in InterfaceLib
  37. ;    is incorrect.  It and the 1.0 version of this file had incorrect parameter
  38. ;    lists for most functions.
  39. ;    
  40. ;    As a first step to avoid runtime errors, the functions in this file were 
  41. ;    renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons").  This will result
  42. ;    in a link time error if a PowerPC application tries to call the functions.
  43. ;    When InterfaceLib is fixed, the new names will be exported and PowerPC
  44. ;    code will then be able to call them.
  45. ;    
  46. ;
  47. ; typedef short             ButtonOpcode
  48. ; ButtonOpcodes 
  49.  
  50. kButtonNoOp                        EQU        0                    ; No action for this button 
  51. kButtonSingleClick                EQU        1                    ; Normal mouse button 
  52. kButtonDoubleClick                EQU        2                    ; Click-release-click when pressed 
  53. kButtonClickLock                EQU        3                    ; Click on press, release on next press 
  54. kButtonCustom                    EQU        6                    ; Custom behavior, data = CursorDeviceCustomButtonUPP 
  55.  
  56. ; Device Classes 
  57. kDeviceClassAbsolute            EQU        0                    ; a flat-response device 
  58. kDeviceClassMouse                EQU        1                    ; mechanical or optical mouse 
  59. kDeviceClassTrackball            EQU        2                    ; trackball 
  60. kDeviceClass3D                    EQU        6                    ; a 3D pointing device 
  61.  
  62. ; Structures used in Cursor Device Manager calls 
  63. CursorData                 RECORD    0
  64. nextCursorData             ds.l   1        ; offset: $0 (0)        ; next in global list 
  65. displayInfo                 ds.l   1        ; offset: $4 (4)        ; unused (reserved for future) 
  66. whereX                     ds.l   1        ; offset: $8 (8)        ; horizontal position 
  67. whereY                     ds.l   1        ; offset: $C (12)        ; vertical position 
  68. where                     ds     Point    ; offset: $10 (16)        ; the pixel position 
  69. isAbs                     ds.b   1        ; offset: $14 (20)        ; has been stuffed with absolute coords 
  70. buttonCount                 ds.b   1        ; offset: $15 (21)        ; number of buttons currently pressed 
  71. screenRes                 ds.w   1        ; offset: $16 (22)        ; pixels per inch on the current display 
  72. privateFields             ds.w   22        ; offset: $18 (24)        ; fields use internally by CDM 
  73. sizeof                     EQU *            ; size:   $44 (68)
  74.                         ENDR
  75.  
  76. ; typedef struct CursorData  CursorData, *CursorDataPtr
  77. CursorDevice             RECORD    0
  78. nextCursorDevice         ds.l   1        ; offset: $0 (0)        ; pointer to next record in linked list 
  79. whichCursor                 ds.l   1        ; offset: $4 (4)        ; pointer to data for target cursor 
  80. refCon                     ds.l   1        ; offset: $8 (8)        ; application-defined 
  81. unused                     ds.l   1        ; offset: $C (12)        ; reserved for future 
  82. devID                     ds.l   1        ; offset: $10 (16)        ; device identifier (from ADB reg 1) 
  83. resolution                 ds.l   1        ; offset: $14 (20)        ; units/inch (orig. from ADB reg 1) 
  84. devClass                 ds.b   1        ; offset: $18 (24)        ; device class (from ADB reg 1) 
  85. cntButtons                 ds.b   1        ; offset: $19 (25)        ; number of buttons (from ADB reg 1) 
  86. filler1                     ds.b   1        ; offset: $1A (26)        ; reserved for future 
  87. buttons                     ds.b   1        ; offset: $1B (27)        ; state of all buttons 
  88. buttonOp                 ds.b   8        ; offset: $1C (28)        ; action performed per button 
  89. buttonTicks                 ds.l   8        ; offset: $24 (36)        ; ticks when button last went up (for debounce) 
  90. buttonData                 ds.l   8        ; offset: $44 (68)        ; data for the button operation 
  91. doubleClickTime             ds.l   1        ; offset: $64 (100)        ; device-specific double click speed 
  92. acceleration             ds.l   1        ; offset: $68 (104)        ; current acceleration 
  93. privateFields             ds.w   15        ; offset: $6C (108)        ; fields used internally to CDM 
  94. sizeof                     EQU *            ; size:   $8A (138)
  95.                         ENDR
  96.  
  97. ; typedef struct CursorDevice  CursorDevice, *CursorDevicePtr
  98. ; for use with CursorDeviceButtonOp when opcode = kButtonCustom 
  99. ;
  100. ; pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
  101. ;
  102.     IF ¬ GENERATINGCFM THEN
  103.         Macro
  104.         _CursorDeviceMove
  105.             moveq    #0,d0
  106.             dc.w     $AADB
  107.         EndM
  108.     ELSE
  109.         IMPORT_CFM_FUNCTION    CursorDeviceMove
  110.     ENDIF
  111.  
  112. ;
  113. ; pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  114. ;
  115.     IF ¬ GENERATINGCFM THEN
  116.         Macro
  117.         _CursorDeviceMoveTo
  118.             moveq    #1,d0
  119.             dc.w     $AADB
  120.         EndM
  121.     ELSE
  122.         IMPORT_CFM_FUNCTION    CursorDeviceMoveTo
  123.     ENDIF
  124.  
  125. ;
  126. ; pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
  127. ;
  128.     IF ¬ GENERATINGCFM THEN
  129.         Macro
  130.         _CursorDeviceFlush
  131.             moveq    #2,d0
  132.             dc.w     $AADB
  133.         EndM
  134.     ELSE
  135.         IMPORT_CFM_FUNCTION    CursorDeviceFlush
  136.     ENDIF
  137.  
  138. ;
  139. ; pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
  140. ;
  141.     IF ¬ GENERATINGCFM THEN
  142.         Macro
  143.         _CursorDeviceButtons
  144.             moveq    #3,d0
  145.             dc.w     $AADB
  146.         EndM
  147.     ELSE
  148.         IMPORT_CFM_FUNCTION    CursorDeviceButtons
  149.     ENDIF
  150.  
  151. ;
  152. ; pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
  153. ;
  154.     IF ¬ GENERATINGCFM THEN
  155.         Macro
  156.         _CursorDeviceButtonDown
  157.             moveq    #4,d0
  158.             dc.w     $AADB
  159.         EndM
  160.     ELSE
  161.         IMPORT_CFM_FUNCTION    CursorDeviceButtonDown
  162.     ENDIF
  163.  
  164. ;
  165. ; pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
  166. ;
  167.     IF ¬ GENERATINGCFM THEN
  168.         Macro
  169.         _CursorDeviceButtonUp
  170.             moveq    #5,d0
  171.             dc.w     $AADB
  172.         EndM
  173.     ELSE
  174.         IMPORT_CFM_FUNCTION    CursorDeviceButtonUp
  175.     ENDIF
  176.  
  177. ;
  178. ; pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
  179. ;
  180.     IF ¬ GENERATINGCFM THEN
  181.         Macro
  182.         _CursorDeviceButtonOp
  183.             moveq    #6,d0
  184.             dc.w     $AADB
  185.         EndM
  186.     ELSE
  187.         IMPORT_CFM_FUNCTION    CursorDeviceButtonOp
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
  192. ;
  193.     IF ¬ GENERATINGCFM THEN
  194.         Macro
  195.         _CursorDeviceSetButtons
  196.             moveq    #7,d0
  197.             dc.w     $AADB
  198.         EndM
  199.     ELSE
  200.         IMPORT_CFM_FUNCTION    CursorDeviceSetButtons
  201.     ENDIF
  202.  
  203. ;
  204. ; pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
  205. ;
  206.     IF ¬ GENERATINGCFM THEN
  207.         Macro
  208.         _CursorDeviceSetAcceleration
  209.             moveq    #8,d0
  210.             dc.w     $AADB
  211.         EndM
  212.     ELSE
  213.         IMPORT_CFM_FUNCTION    CursorDeviceSetAcceleration
  214.     ENDIF
  215.  
  216. ;
  217. ; pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
  218. ;
  219.     IF ¬ GENERATINGCFM THEN
  220.         Macro
  221.         _CursorDeviceDoubleTime
  222.             moveq    #9,d0
  223.             dc.w     $AADB
  224.         EndM
  225.     ELSE
  226.         IMPORT_CFM_FUNCTION    CursorDeviceDoubleTime
  227.     ENDIF
  228.  
  229. ;
  230. ; pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
  231. ;
  232.     IF ¬ GENERATINGCFM THEN
  233.         Macro
  234.         _CursorDeviceUnitsPerInch
  235.             moveq    #10,d0
  236.             dc.w     $AADB
  237.         EndM
  238.     ELSE
  239.         IMPORT_CFM_FUNCTION    CursorDeviceUnitsPerInch
  240.     ENDIF
  241.  
  242. ;
  243. ; pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
  244. ;
  245.     IF ¬ GENERATINGCFM THEN
  246.         Macro
  247.         _CursorDeviceNextDevice
  248.             moveq    #11,d0
  249.             dc.w     $AADB
  250.         EndM
  251.     ELSE
  252.         IMPORT_CFM_FUNCTION    CursorDeviceNextDevice
  253.     ENDIF
  254.  
  255. ;
  256. ; pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
  257. ;
  258.     IF ¬ GENERATINGCFM THEN
  259.         Macro
  260.         _CursorDeviceNewDevice
  261.             moveq    #12,d0
  262.             dc.w     $AADB
  263.         EndM
  264.     ELSE
  265.         IMPORT_CFM_FUNCTION    CursorDeviceNewDevice
  266.     ENDIF
  267.  
  268. ;
  269. ; pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
  270. ;
  271.     IF ¬ GENERATINGCFM THEN
  272.         Macro
  273.         _CursorDeviceDisposeDevice
  274.             moveq    #13,d0
  275.             dc.w     $AADB
  276.         EndM
  277.     ELSE
  278.         IMPORT_CFM_FUNCTION    CursorDeviceDisposeDevice
  279.     ENDIF
  280.  
  281.     ENDIF ; __CURSORDEVICES__
  282.